]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appsMenu: Add side parameter
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 11 Aug 2021 20:53:54 +0000 (22:53 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 16 Aug 2021 21:28:22 +0000 (21:28 +0000)
In order to re-use the menu in the overview, we must be able to
change the side of the arrow, so expose the parent class parameter.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>

js/ui/appMenu.js

index a795e8e6166147e19d2a2c9b49b3062080cd6818..85c193bfe8ea2e83891805bcfa7eb9b92f14126f 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported AppMenu */
-const { Gio, GLib, Meta, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi;
 
 const PopupMenu = imports.ui.popupMenu;
 const Main = imports.ui.main;
@@ -8,9 +8,17 @@ const Main = imports.ui.main;
 var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
     /**
      * @param {Clutter.Actor} sourceActor - actor the menu is attached to
+     * @param {St.Side} side - arrow side
      */
-    constructor(sourceActor) {
-        super(sourceActor, 0.5, St.Side.TOP);
+    constructor(sourceActor, side = St.Side.TOP) {
+        if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
+            if (side === St.Side.LEFT)
+                side = St.Side.RIGHT;
+            else if (side === St.Side.RIGHT)
+                side = St.Side.LEFT;
+        }
+
+        super(sourceActor, 0.5, side);
 
         this.actor.add_style_class_name('app-menu');